class ArtistsController < ApplicationController
  LIST_SIZE = 5
  
  def index
  end

  def show
   @artist = Artist.find(params[:id]);
   @page_title = "Viewing artist information for " + @artist.name
    
   @otherByArtist = @artist.artworks
   @otherByArtist = @otherByArtist.sort_by { rand }[0..3]
   region = @artist.region
   
   @otherRegionalArt = Array.new
   for person in region.artists
      if person != @artist
        for art in person.artworks        
          @otherRegionalArt.push(art)
         end
      end
   end
    
    @otherRegionalArt = @otherRegionalArt.uniq
    @otherRegionalArt = @otherRegionalArt.sort { rand(3)-1 }[0..(LIST_SIZE-1)]
    
    @RegionalArtistPictures = Array.new
    for artist in region.artists
      pic = Picture.find_by_artist_id(artist.id)
      if !pic.nil?
        @RegionalArtistPictures.push(pic)
      end
    end
    
    @map = GMap.new("map_div")
    @map.control_init(:large_map => false, :small_map => true,:map_type => true)
    @map.center_zoom_init([@artist.map_lat,@artist.map_lon],@artist.map_zoom)
    @map.overlay_init(GMarker.new([@artist.map_lat,@artist.map_lon],:title => @artist.fullname, :info_window => "info"))
  end

  def search
  end
end
